package com.jcsz.gulimall.ware.dao;

import com.jcsz.gulimall.ware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jcsz.gulimall.ware.vo.SkuHasStockVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品库存
 * 
 * @author 一把Po吉他
 * @email volibear@gulimall.com
 * @date 2022-10-16 09:18:54
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    void updateStock(@Param("skuId")Long skuId,@Param("wareId")Long wareId,@Param("stock")Integer stock);

    Long getStockBySpuId(Long spuId);

    List<Long> listWareIdHasSkuStock(@Param("skuId") Long skuId);

    Long lockSkuStock(@Param("skuId") Long skuId, @Param("id") Long id, @Param("num") Integer num);

    Long unLockStock(@Param("skuId") Long skuId, @Param("skuNum")Integer skuNum, @Param("wareId")Long wareId);
}
